package com.microservices.yucloud.appweb.action;

import com.microservices.yucloud.appweb.contants.BizOrderConstants;
import com.microservices.yucloud.appweb.domain.StateMachineRequest;
import com.microservices.yucloud.appweb.enums.BizOrderEventsEnum;
import com.microservices.yucloud.appweb.enums.BizOrderStatusEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.statemachine.StateContext;
import org.springframework.statemachine.action.Action;
import org.springframework.stereotype.Service;

/**
 * @author zy
 * @date 2019-08-30 15:45
 **/
@Slf4j
@Service
public class OrderComputeAction implements Action<BizOrderStatusEnum, BizOrderEventsEnum> {

    @Override
    public void execute(StateContext<BizOrderStatusEnum, BizOrderEventsEnum> stateContext) {
        StateMachineRequest request = stateContext.getMessage().getHeaders().get(BizOrderConstants.STATE_MACHINE_BIZ_ORDER, StateMachineRequest.class);
        log.info("推荐流程开始orders:[{}]", request.getBizModel());
        try {
            //调用推荐接口

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
